package com.whmskj.xjlhsc.mobie.empProPlan.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.whmskj.xjlhsc.mobie.empProPlan.entity.ProPersonnelStand;
import com.whmskj.xjlhsc.mobie.empProPlan.service.ProPersonnelStandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;

/**
 * 人员看台表
 *
 * @author lk
 * @since 2025-07-07 10:56:56
 */
@SaIgnore
@RestController
@RequestMapping("/proPersonnelStand")
public class ProPersonnelStandController {

    @Autowired
    private ProPersonnelStandService proPersonnelStandService;

    /**
     * 分页查询
     *
     * @param params
     * @return
     */
    @PostMapping("/findPage")
    public ResponseEntity<List<ProPersonnelStand>> findPage(@RequestBody ProPersonnelStand params) {
        List<ProPersonnelStand> result = proPersonnelStandService.findPage(params);
        return ResponseEntity.ok(result);
    }
    /**
     * 列表查询
     *
     * @param params
     * @return
     */
    @PostMapping("/findList")
    public ResponseEntity<List<ProPersonnelStand>> findList(@RequestBody ProPersonnelStand params) {
        List<ProPersonnelStand> result = proPersonnelStandService.findList(params);
        return ResponseEntity.ok(result);
    }

    /**
     * 查询
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public ResponseEntity<ProPersonnelStand> findById(@PathVariable("id") Long id) {
        ProPersonnelStand proPersonnelStand = proPersonnelStandService.findById(id);
        return ResponseEntity.ok(proPersonnelStand);
    }

    /**
     * 新增
     *
     * @param proPersonnelStand
     * @return
     */
    @PostMapping
    public ResponseEntity<Boolean> insert( @RequestBody ProPersonnelStand proPersonnelStand) {
        boolean result = proPersonnelStandService.insert(proPersonnelStand);
        return ResponseEntity.ok(result);
    }

    /**
     * 修改
     *
     * @param proPersonnelStand
     * @return
     */
    @PutMapping
    public ResponseEntity<Boolean> update( @RequestBody ProPersonnelStand proPersonnelStand) {
        boolean result = proPersonnelStandService.update(proPersonnelStand);
        return ResponseEntity.ok(result);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public ResponseEntity<Integer> delete(@PathVariable("id") Long id) {
        int result = proPersonnelStandService.delete(id);
        return ResponseEntity.ok(result);
    }

}